home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / include / netFDDI.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-05  |  3.8 KB  |  140 lines

  1. /*
  2.  * netFDDI.h --
  3.  *
  4.  *    This defines the format of an FDDI packet.
  5.  *
  6.  * Copyright 1992 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  *
  15.  *
  16.  * $Header: /sprite/src/lib/include/RCS/netFDDI.h,v 1.6 92/06/05 12:33:43 voelker Exp $
  17.  */
  18.  
  19. #ifndef _NETFDDI
  20. #define _NETFDDI
  21.  
  22.  
  23. #include "machparam.h"
  24.  
  25. /*
  26.  * Compare two FDDI addresses.
  27.  */
  28.  
  29. #define    Net_FDDIAddrCmp(e1,e2) Net_FDDIAddrCmpPtr(&e1,&e2)
  30.  
  31. /*
  32.  * Compare bytes backward because FDDI addresses tend to start with the
  33.  * same few bytes.
  34.  */
  35.  
  36. #define    Net_FDDIAddrCmpPtr(e1,e2) \
  37.    (!(((e1)->byte6 == (e2)->byte6) && ((e1)->byte5 == (e2)->byte5) && \
  38.     ((e1)->byte4 == (e2)->byte4) && ((e1)->byte3 == (e2)->byte3) && \
  39.     ((e1)->byte2 == (e2)->byte2) && ((e1)->byte1 == (e2)->byte1)))
  40.  
  41. /*
  42.  * FDDI Address - 6 bytes
  43.  */
  44.  
  45. typedef struct {
  46.     unsigned char byte1;
  47.     unsigned char byte2;
  48.     unsigned char byte3;
  49.     unsigned char byte4;
  50.     unsigned char byte5;
  51.     unsigned char byte6;
  52. } Net_FDDIAddress;
  53.  
  54. #define    NET_FDDI_ADDR_BYTE1(e)    ((e).byte1)
  55. #define    NET_FDDI_ADDR_BYTE2(e)    ((e).byte2)
  56. #define    NET_FDDI_ADDR_BYTE3(e)    ((e).byte3)
  57. #define    NET_FDDI_ADDR_BYTE4(e)    ((e).byte4)
  58. #define    NET_FDDI_ADDR_BYTE5(e)    ((e).byte5)
  59. #define    NET_FDDI_ADDR_BYTE6(e)    ((e).byte6)
  60.  
  61. #ifdef sun4
  62. #define    NET_FDDI_ADDR_COPY(src,dst)    \
  63.     ((dst).byte1 = (src).byte1);    \
  64.     ((dst).byte2 = (src).byte2);    \
  65.     ((dst).byte3 = (src).byte3);    \
  66.     ((dst).byte4 = (src).byte4);    \
  67.     ((dst).byte5 = (src).byte5);    \
  68.     ((dst).byte6 = (src).byte6)
  69. #else
  70. #define    NET_FDDI_ADDR_COPY(src,dst) ((dst) = (src))
  71. #endif
  72.  
  73. /*
  74.  * FDDI Header - 16 bytes 
  75.  */
  76.  
  77. typedef struct Net_FDDIHdr {
  78.     unsigned char   prh[3];        /* Packet request headers */
  79.     unsigned char   frameControl;  /* Frame control byte */
  80.     Net_FDDIAddress dest;          /* Destination Address of packet */
  81.     Net_FDDIAddress source;        /* Source Address of packet */
  82. } Net_FDDIHdr;
  83.  
  84. #define    NET_FDDI_HDR_DESTINATION(e)    ((e).destination)
  85. #define    NET_FDDI_HDR_SOURCE(e)        ((e).source)
  86. #define    NET_FDDI_HDR_TYPE(e)        ((e).type)
  87.  
  88. #define    NET_FDDI_HDR_DESTINATION_PTR(e)    &((e).destination)
  89. #define    NET_FDDI_HDR_SOURCE_PTR(e)    &((e).source)
  90. #define    NET_FDDI_HDR_TYPE_PTR(e)    &((e).type)
  91.  
  92. #define    NET_FDDI_HDR_COPY(src, dst) ((dst) = (src))
  93.  
  94. /*
  95.  * The docs say that the minimum for an LLC packet is 20.
  96.  */
  97. #define    NET_FDDI_MIN_BYTES    20
  98. #define    NET_FDDI_MAX_BYTES    4480
  99.  
  100. /*
  101.  * This value is used to distinguish Sprite FDDI packets from other
  102.  * FDDI packets on the same ring.  This right here is a major kludge
  103.  * until we can get the Data Link Specification.  This actually is an LLC
  104.  * of priority 3 frame control, but oh well.  We should be using the Data
  105.  * Link Specs, but we never got ahold of them.
  106.  *
  107.  * This value is placed in the header of each packet in 
  108.  * netRoute.c:Net_InstallRoute().
  109.  *
  110.  * FDDI packets are checked for this value in netDFRecv.c:GotAPacket().
  111.  */
  112.  
  113. #define NET_FDDI_SPRITE                 0x53
  114.  
  115. /*
  116.  * Definitions of known Ethernet packet types (from rfc990, except for SPRITE
  117.  * and TRAIL).
  118.  *
  119.  * These mean nothing to the FDDI driver until encapsulated ethernet
  120.  * is attempted.
  121.  */
  122. #define NET_FDDI_PUP            0x0200
  123. #define NET_FDDI_PUP_ADDR_TRANS        0x0201
  124. #define NET_FDDI_XNS_IDP        0x0600
  125. #define NET_FDDI_IP            0x0800
  126. #define NET_FDDI_ARP            0x0806
  127. #define NET_FDDI_XNS_COMPAT        0x0807
  128. /* #define NET_FDDI_SPRITE        0x0500 */
  129. #define NET_FDDI_SPRITE_ARP        0x0502 /* deprecated */
  130. #define NET_FDDI_SPRITE_DEBUG        0x0504
  131. #define NET_FDDI_TRAIL            0x1000
  132. #define NET_FDDI_REVARP            0x8035
  133. #define NET_FDDI_MOP            0x6001
  134.  
  135. #endif /* _NETFDDI */
  136.  
  137.  
  138.  
  139.  
  140.